import {
    INCREMENT,
    DECREMENT,
    UPDATEUSERS
} from "../action"

export default function reducer(state, action) {
    switch(action.type){
        case INCREMENT:
            return {
                ...state,
                age: state.age + action.payload
            }
        case DECREMENT:
            return {
                ...state,
                age: state.age - action.payload
            }
        case UPDATEUSERS:
            return {
                ...state,
                users: action.users
            }
        default:
            return state
    }
}